list_1 = []
try:
    with open("log.txt","r",encoding="utf-8") as f:
        for line in f:
            list_1.append(line.rstrip("\n"))
except FileNotFoundError:
    pass
print("你好")
def say_hi(name):
    print(f"Hi,{name}!")
say_hi("Python")
user = input("请输入你的名字")
say_hi(user)
list_1 = []
while True:
    user = input("请输入名字（直接回车退出）：")
    say_hi(user)
    
    if user == "":
        break
    list_1.append(user)
print("今天接待过的客人：",list_1)
print("拜拜")
print("今天接待过的客人（倒序）：",list(reversed(list_1)))
print("总共接待人数：",len(list_1))
with open("log.txt","w",encoding="utf-8")as f:
    for name in list_1:
        f.write(name + "\n")
print("今日接待清单：")
for idx, name in enumerate(list_1,1):
    print(f"{idx:>2}. {name}")
